//Page Object
import { require } from '../../require/index.js'
Page({
  data: {
    swiperList: [],
    catesList: [],
    floorList: []
  },
  //options(Object)
  onLoad: function(options){
    this.getSwiperList()
    this.catesList()
    this.floorList() 
    // var reqTask = wx.request({
    //   url: 'https://api-hmugo-web.itheima.net/api/public/v1/home/swiperdata',
    //   success: (result)=>{
    //     console.log(result)
    //     if (result.data.meta.status === 200) {
    //       this.setData({
    //         swiperList: result.data.message
    //       })
    //     }
    //   }
    // });
  },
  getSwiperList () {
    require({url:'/home/swiperdata'})
    .then(result => {
      this.setData({
        swiperList: result
      })
    })
  },
  catesList () {
    require({url:'/home/catitems'})
    .then(result => {
      this.setData({
        catesList: result
      })
    })
  },
  floorList () {
    require({url:'/home/floordata'})
    .then(result => {
      this.setData({
        floorList: result
      })
    })
  }
});